<!-- Loads initialization file with a couple of variables -->

<%@ include file="../../inc/init.jsp" %>

<html>
	<head>
		<title>
			Graduate Admission System | University of California - San Diego | 
			Verification Page
		</title>
		<link type="text/css" rel="stylesheet" href="<%= BASE %>css/main.css">
	</head>
	<body>
	<div class="header-top"></div>
		<div class="header">
			<a href="<%= BASE %>index.jsp"><img src="<%= BASE %>img/logo.png"></a>
		</div>
		<div class="content">
		<div class="message"></div>
		<%
		
			try {
				
				/** Get applicant object **/
				
				Applicant a = (Applicant)session.getAttribute("applicant");
				
				/** Write applicant information to database **/
				
				a.writeToDatabase();
				
				/** Get degree list **/
				
				ArrayList<Degree> dAl = (ArrayList<Degree>)session.getAttribute("degrees");
				
				/** Write all degrees in the list to the database **/
				
				for(int i = 0; i < dAl.size(); i++)
				{
					Degree d = dAl.get(i);
					d.setApplicantId(a.getApplicantId());
					d.writeToDatabase();
				}
				
				out.print("Thank you for applying. Your applicant id is #" + a.getApplicantId() +".<br><br>" +
						  "Click <a href=\"../index.jsp\">here</a> to get back to the overview.");
				
			}
			catch(Exception e) {
				e.printStackTrace();
			}
		%>
		</div>
	</body>
</html>